package mobile.game.core.support.tuple;

import java.io.IOException;

import mobile.game.core.InputStream;
import mobile.game.core.OutputStream;
import mobile.game.core.interfaces.ISerilizable;

/**
 * @author g
 *
 * 2元组
 * @param <A>
 * @param <B>
 */
public class TwoTuple<A, B> implements ISerilizable {
	public final A first;
	public final B second;
	
	public TwoTuple(A first, B second) {
		super();
		this.first = first;
		this.second = second;
	}

	@Override
	public void writeTo(OutputStream out) throws IOException {
		out.write(first);
		out.write(second);
	}

	@Override
	public void readFrom(InputStream in) throws IOException {
		
	}

	public static ISerilizable create(InputStream in) throws IOException {
		return new TwoTuple<>(in.read(), in.read());
	}

}
